package com.magicmovie.api.service;

import com.magicmovie.api.service.impl.OrderServiceImpl;
import com.magicmovie.entity.Order;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(name = "service",fallback = OrderServiceImpl.class)
public interface OrderService {
    @RequestMapping(value = "/order/findByUidAndMovieId",method = RequestMethod.GET)
    Order findByUidAndMovieId(@RequestParam("uid") Integer uid,@RequestParam("movieId") Integer movieId);

    @RequestMapping(value = "/order/findByCustomer",method = RequestMethod.GET)
    List<Map<String, Object>> findByCustomer(@RequestParam("customerId") Integer customerId, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);

    @RequestMapping(value = "/order/createOrder",method = RequestMethod.GET)
    String crateOrder(@RequestParam("price") Float price,@RequestParam("payType") String payType,@RequestParam("site") String site,@RequestParam("customerId") Integer customerId,@RequestParam("movieId") Integer movieId);

    @RequestMapping(value = "/order/findByOrderNum",method = RequestMethod.GET)
    Order findByOrderNum(@RequestParam("orderNum") String orderNum);

    @RequestMapping(value = "/order/update",method = RequestMethod.POST)
    void update(@RequestBody Order order);

    @RequestMapping(value = "/order/payByBalance",method = RequestMethod.POST)
    void payByBalance(@RequestBody Order order);

    @RequestMapping(value = "/order/updateOrderStatus",method = RequestMethod.POST)
    void updateOrderStatus(@RequestBody Order order);
}
